$(function(){
    $(".authLogin").click(function () {
        var username = $('#username').val();
        var password = $('#password').val();
        if (username == '' || password == '') {
            parent.layer.alert("用户名或密码不能为空");
            return false;
        } else {
            $.ajax({
                url: ApiUrl + "/authLogin",
                type: 'POST',
                data: {username:username, password:password},
                dataType: 'JSON',
                success: function(result) {
                    if(result.code == 200 && result.data == "success"){
                        parent.layer.msg(result.message);
                        window.location.replace('default.html');
                    } else {
                        parent.layer.msg(result.message);
                        return false;
                    }
                }
            });
        }
    });
});